package xpn.platform.modules.stamp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.BasePathAwareController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@BasePathAwareController
@ResponseBody
@RequestMapping("stamp")
public class StampController {
    @Autowired
    StampService stampService;
    /**
     * 为指定记录上载附件
     *
     * @param entityLink
     *            ：所属实体的唯一RESTful的链接，必须指定。
     * @param sealLink
     *            : 印章的连接
     * @param sealCategory
     *            : 印章的分类
     * @throws Throwable
     */
    @GetMapping(value = "")
    public String stamp(@RequestParam(value = "entityLink", required = true, defaultValue = "") String entityLink,
                              @RequestParam(value = "sealLink", required = true, defaultValue = "") String sealLink,
                              @RequestParam(value = "sealCategory", required = true, defaultValue = "") String sealCategory,
                              @RequestParam(value = "userId", required = true, defaultValue = "") Long userId
                               ) throws Throwable {
        stampService.stamp(entityLink,sealLink,sealCategory,userId);
        return "盖章成功！";
    }
}
